<template>
    <div>
        <div class="title-header">
            <div class="line"></div>
            <h3>提单处理</h3>
        </div>
        <base-list ref="person" :condition="condition" :datas.sync="person" :pageSearch="pageSearch">
            <el-form :inline="true" :model="condition" class="search-form" slot="search" label-width="80px">
                <el-row>
                    <el-col :span="8" class="search-width4">
                        <el-form-item label="货主单位" prop="cargoOwnerName">
                            <auto-search-name v-model="condition['cargoOwnerName']" placeholder="请选择"
                                @selectName="v=>condition['cargoOwnerName']=v"
                                @selectId="v=>condition['cargoOwnerId']=v"
                                @selectCode="v=>condition['cargoOwnerCode']=v" :name="condition['cargoOwnerName']">
                            </auto-search-name>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="search-width4">
                        <el-form-item label="提货单位" prop="cargoOwnerName">
                            <auto-search-name v-model="condition['cargoOwnerName']" placeholder="请选择"
                                @selectName="v=>condition['cargoOwnerName']=v"
                                @selectId="v=>condition['cargoOwnerId']=v"
                                @selectCode="v=>condition['cargoOwnerCode']=v" :name="condition['cargoOwnerName']">
                            </auto-search-name>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="search-width4">
                        <el-form-item label="提单号" prop="cargoOwnerName">
                            <el-input v-model="condition['cargoOwnerName']"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="3">
                        <el-button type="primary" icon="el-icon-search" @click="loadData" class="ml-80">查 询</el-button>
                    </el-col>
                </el-row>
            </el-form>
            <el-table slot="list" :data="person" border stripe max-height="500">
                <el-table-column label="序号" type="index" width="50"></el-table-column>
                <el-table-column label="提单号" prop="customDeliveryNo"></el-table-column>
                <el-table-column label="发货单号" prop="entrustNo"></el-table-column>
                <el-table-column label="提单类型" prop="ifTemp">
                    <template slot-scope='scope'>
                        {{scope.row.ifTemp | _filterStockType}}
                    </template>
                </el-table-column>
                <el-table-column label="状态" prop="status">
                    <template slot-scope='scope'>
                        {{scope.row.status | _filterBillStatus}}
                    </template>
                </el-table-column>
                <el-table-column label="提单来源" type="index"></el-table-column>
                <el-table-column label="货主" prop="cargoOwnerName"></el-table-column>
                <el-table-column label="提货单位" prop="deliveryBy"></el-table-column>
                <el-table-column label="出库方式" prop="outWay">
                    <template slot-scope='scope'>
                        {{scope.row.outWay | _filterOutWay}}
                    </template>
                </el-table-column>
                <el-table-column label="是否罢单提货" prop="ifStrikeBIll">
                    <template slot-scope='scope'>
                        {{scope.row.ifStrikeBIll | _filterTrueOrFalse}}
                    </template>
                </el-table-column>
                <el-table-column label="是否成品" prop="cargoOwnerName"></el-table-column>
                <el-table-column label="品名" prop="cargoName"></el-table-column>
                <el-table-column align="center" label="操作" width="150">
                    <template slot-scope="scope">
                        <el-button size="small" type="text" @click="handleDialogFormOpen(scope.row)">
                            查看
                        </el-button>
                    </template>
                </el-table-column>
            </el-table>
        </base-list>
        <view-stock-detail ref="viewStockDetail" @load="loadData"></view-stock-detail>
    </div>
</template>
<script>
    import viewStockDetail from '@/views/business/goods/out/viewStockDetail' //货主组件
    import autoSearchName from '@/components/autocomplete/autoSearchName' //货主组件
    import {
        getOutStockEntrust,
        getOutStockDetail,
        outTempHandle
    } from '@/api/things/out'
    export default {
        components: {
            autoSearchName,
            viewStockDetail
        },
        data() {
            return {
                condition: {}, // 查询条件
                person: [],
                component: '',
                dialogFormVisible: false, // table数组
                pageSearch: getOutStockEntrust, // 分页查询api接口
                ldTitle: '',
                subform: {
                    entrustNo: '',
                    customDeliveryNo: '',
                    ifChange: false
                }
            }
        },
        mounted() {
            this.loadData()
        },
        methods: {
            loadData() {
                this.$refs.person.loadData()
            },
            handleDialogFormOpen(item) {
                this.$refs.viewStockDetail.stockdialogForm = true
                this.$refs.viewStockDetail.ids = item.entrustNo
                this.$refs.viewStockDetail.selectChange()
            }
        },
    }

</script>
<style lang="scss" scoped>
    .title-header {
        width: 90%;
        display: flex;
        height: 30px;
        margin-bottom: 20px;
    }

    h3 {
        margin-left: 10px;
    }

    .line {
        border-left: solid 5px #00a1ff;
        height: 18px;
        margin-top: 5px;
    }

</style>
